<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j">
    <a4j:outputPanel ajaxRendered="true">

        <rich:dataList var="_settings"
                       value="#{settingsList.resultList}">
            <s:link value="settings_#{_settings.id}">
                <f:param name="settingsId"
                         value="#{_settings.id}"/>
                <f:param name="view"
                             value="#{param.view}"/>
            </s:link>
        </rich:dataList>

        <h:form id="settingsform"
                styleClass="ki-form">
            <fieldset class="columnar label-top">
                <h:outputLabel value="filePathClient:"
                               for="filePathClient"/>
                <h:inputText id="filePathClient"
                             value="#{settingsHome.instance.filePathClient}"/>
                <h:outputLabel value="filePathServer:"
                               for="filePathServer"/>
                <h:inputText id="filePathServer"
                             value="#{settingsHome.instance.filePathServer}"/>
                <h:outputLabel value="default category:"
                               for="defaultcategory"/>
                <h:selectOneMenu value="#{settingsHome.instance.defaultCategory}"
                                 id="defaultcategory">
                    <s:selectItems value="#{parentCategories}"
                                   var="_category"
                                   label="#{_category.name}"
                                   noSelectionLabel="pick category"/>
                    <s:convertEntity/>
                </h:selectOneMenu>
            </fieldset>
            <fieldset class="buttons">
                <a4j:commandButton id="save"
                                   value="Save"
                                   action="#{settingsHome.persist}"
                                   rendered="#{!settingsHome.managed and settingsList.resultList.isEmpty()}">
                    <f:param name="view"
                             value="#{param.view}"/>
                    <s:conversationId/>
                </a4j:commandButton>
                <a4j:commandButton id="update"
                                   value="Update"
                                   action="#{settingsHome.update}"
                                   rendered="#{settingsHome.managed}">
                    <f:param name="view"
                             value="#{param.view}"/>
                    <s:conversationId/>
                </a4j:commandButton>
            </fieldset>
        </h:form>
    </a4j:outputPanel>
</ui:composition>
